# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=castero
pkgver=0.9.5
pkgrel=3
pkgdesc="TUI podcast client for the terminal"
url="https://github.com/xgi/castero"
arch="noarch"
license="MIT"
depends="
	py3-beautifulsoup4
	py3-cjkwrap
	py3-grequests
	py3-lxml
	py3-mpv
	py3-requests
	py3-tz
	python3
	"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/xgi/castero/archive/v$pkgver.tar.gz
	fix-display-tests.patch
	"

prepare() {
	default_prepare
	# Remove py3-vlc as we rely on py3-mpv
	sed -i '/python-vlc/d' setup.py
}

build() {
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not test_player_vlcplayer'
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
3bd962f8a609dbd37cd133902f1cf8d619749179aeb790339a52849e4222c95b35d396a8b20e8690b412616cb2699fcba3d3ecfc87360579eaa08dfdddc9db30  castero-0.9.5.tar.gz
ccf2d58cf6c700feab8ef68a4c811f7df9489ddbdddc6188b1b7a57c6f247ca9442e813e577a7a252d8ab61a8b60b042338802972118af00ad4343134a45d5a2  fix-display-tests.patch
"
